#include<stdio.h>
int main()
{
 
int  comp_int(void* p1,void* p2)
{
	return *(int*)p1-*(int*)p2;
}
 
void swap(void* p1,void* p2,int size)
{
	for (int m = 0; m < size; m++)
	{
		char p3 = *((char*)p1+m);
		*((char*) p1+m) = *((char*)p2+m);
		*((char*) p2+m) =  p3;
	}
}
 
void copy_qsort(void* base, int a, int size, int (*p) (void*, void*))
{
	for (int i = 0; i < a - 1; i++)    
	{
		for (int v = 0; v < a - 1 - i; v++)
		{
			int c = p((char*)base + v * size, (char*)base + (v + 1) * size);   
			if (c > 0)
			{
				swap((char*)base + v * size, (char*)base + (v + 1) * size,size);  
			}
		}
	}
}
 
int main()
{
	int arr[] = { 5,6,9,2,1,6,7,8,4,3,10 };
 
	int num = sizeof(arr) / sizeof(arr[0]);
	int count = sizeof(arr[0]);
	
	copy_qsort(arr,num ,count, comp_int);    
 
	for (int i = 0; i < num; i++)
	{
		printf("%d ", arr[i]);   
	}
	return 0;
}
}
